const CompressionPlugin = require('compression-webpack-plugin')

module.exports = {
  publicPath: "./",
  outputDir: process.env.outputDir,
  productionSourceMap: false,
  transpileDependencies: [
    'vue-echarts',
    'resize-detector'
  ],
  productionSourceMap: false,
  chainWebpack: config => {
    config
      .plugin('html')
      .tap(args => {
        args[0].title = '谷子优品管理后台'
        return args
      })
  },
  configureWebpack: config => {
    return {
      plugins: [
        new CompressionPlugin({
          algorithm: 'gzip',//开启gzip
          test: /\.js$|\.html$|.\css/, // 匹配文件名
          threshold: 10240, // 对超过10k的数据压缩
          deleteOriginalAssets: false // 不删除源文件
        })
      ]

    }
  },
  devServer: {
    port: 9090,
    proxy: {
      'mall': {
        target: `https://houlangguzi.com`, // 演示环境
        changeOrigin: true,
        secure: false,
        // pathRewite:{
        //   "^/api"	:	"/"		//^首匹配
        // }
      }
    }
  }
};